<template>
	<view class="my_tabBar">
		<view class="tabbar_list">
			<view class="item" v-for="(item,i) in tabBarList" :key="i" @click="activeTab(i)">
				<image :src="item.icon" class="icon" v-show="!(i === index)"></image>
				<image :src="item.icon_active" class="icon" v-show="(i === index)"></image>
				<text :style="(i === index) ? {color:'rgba(58, 170, 255, 0.9)'} : {}">{{item.name}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations,
	} from 'vuex'
	export default {
		name:"my-tabBar",
		computed:{
			...mapState('tabbar',['index','tabBarList']),
			...mapState('info',['myInfo'])
		},
		props: ['routePath'],
		data() {
			return {
			};
		},
		created() {
			uni.hideTabBar();
			let myInfo = uni.getStorageSync('myInfo')
			if(myInfo === ''){
				uni.navigateTo({
					url:'/subpkg/login/login'
				})
				return;
			}
			this.initTab(this.routePath)
		},
		methods:{
			...mapMutations('tabbar',['activeTab','initTab'])
		}
	}
</script>

<style lang="scss">
.my_tabBar{
	width: 750rpx;
	// height: 6vh;
	height: 100rpx;
	background-color: rgba(205, 205, 205, 0.4);
	backdrop-filter: blur(20rpx);
	position: fixed;
	bottom: 0;
	
	.tabbar_list{
		width: 750rpx;
		// height: 6vh;
		height: 100rpx;
		display: flex;
		justify-content: space-around;
		.item{
			display: flex;
			align-items: center;
			flex-direction: column;
			width: 100rpx;
			.icon{
				width: 60rpx;
				height: 60rpx;
			}
			text{
				color: #a0a0a0;
				font-size: 28rpx;
			}
			&:active{
				transform: scale(0.9);
				transition: transform 0.1s;
			}
		}
	}
}
</style>